import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:oramemo/common/langs/index.dart';

/// 提示工具
abstract class TipUtil {
  /// 显示错误对话框
  static void showError(String message) {
    Get.dialog(
      AlertDialog(
        title: Text(TextKey.error.tr),
        content: Text(message),
        actions: [
          TextButton(
            onPressed: () => Get.back(),
            child: Text(TextKey.confirm.tr),
          ),
        ],
      ),
    );
  }

  /// 显示成功对话框
  static Future showSuccess(String message) async {
    return await Get.dialog(
      AlertDialog(
        title: Text(TextKey.success.tr),
        content: Text(message),
        actions: [
          TextButton(
            onPressed: () {
              Get.back(); // 返回上一页
            },
            child: Text(TextKey.confirm.tr),
          ),
        ],
      ),
    );
  }
}
